#ifndef __UARTCONFIG_H__
#define __UARTCONFIG_H__
#include "basictype.h"

enum {
  UART_PARITY_NO = 0,
  UART_PARITY_ODD = 4,
  UART_PARITY_EVEN = 5,
  UART_PARITY_FORCE_1 = 6,
  UART_PARITY_FORCE_0 = 7,
  UART_PARITY_COUNT,
};

enum {
  UART_STOPBIT_1 = 0,
  UART_STOPBIT_2,
  UART_STOPBIT_COUNT,
};

enum {
  UART_DATABIT_5 = 0,
  UART_DATABIT_6,
  UART_DATABIT_7,
  UART_DATABIT_8,
  UART_DATABIT_COUNT,
};

typedef struct UartConfig_t{
  UINT32 baudRate;
  UINT8  dataBit;
  UINT8  stopBit;
  UINT8  parity;
} UartConfig_t;

extern void * UartConfig_Init(UartConfig_t *pConfig,UINT32 baudRate,UINT8 dataBit,UINT8 stopBit,UINT8 parity);
extern BOOL32 UartConfig_Check(UartConfig_t *pConfig,UINT32 uartClk);
extern BOOL32 UartConfig_CheckFrameError(UartConfig_t *pConfig,UINT32 uartClk);

#endif